home *** CD-ROM | disk | FTP | other *** search
- Path: news.nodak.edu!plains!ishaq
- From: ishaq@plains.nodak.edu (Jeffro)
- Newsgroups: comp.lang.c++
- Subject: Using cin like sscanf()?
- Date: 24 Feb 1996 21:02:37 GMT
- Organization: North Dakota Higher Education Computing Network (NDHECN)
- Message-ID: <4gnudd$dd4@daily-planet.nodak.edu>
- NNTP-Posting-Host: plains.nodak.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=US-ASCII
- Content-Transfer-Encoding: 7bit
- X-Newsreader: TIN [version 1.2 PL2]
-
- greetings! I've always wondered if this is possible. Well, I'm sure
- it's possible, but how is it done? Say I input a string into string:
-
- char string[] = "This is a character string.";
- char buffer[24];
-
- How can I tell cin to read from string instead of stdin so I can do
- soemthing like this:
-
- //cin.read_from(string)
- while (cin >> buffer) cout << buffer; //Outputs string
- //cin.read_from(stdin)
-
- This should be similar to:
-
- while (sscanf(string, "%s", &buffer)) cout << buffer;
-
- Any ideas?
- Thanks!
- -jeff
- --
- .,;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.
- - Jeff Ishaq ishaq@plains.nodak.edu Computer Science major -
- - at North Dakota State University in Fargo, ND. Drop me a line, eh? -
- .,;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.;';.,.
- - better-than-average Phish songs: Chalk Dust Torture, You Enjoy Myself,
- - David Bowie, Mound, Split Open and Melt, My Friend (has got a knife),
- - Fire Up The Ganga (live, of course), Contact
-